package com.chinasoft.one_to_one;
import com.chinasoft.bean.Card;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class Test01 {
    @Test
    public void testSelect() throws IOException {
        InputStream is = Resources.getResourceAsStream("MyTabisConfig.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(is);
        SqlSession sqlSession = sqlSessionFactory.openSession(true);
        CardMapper mapper = sqlSession.getMapper(CardMapper.class);
        List<Card> cards = mapper.selectAll();

        cards.forEach(System.out::println);


    }
}
